#include "savexmldialog.h"

SaveXMLDialog::SaveXMLDialog()
{
f = QLatin1String("");
s = QLatin1String("");
setupUi(this);
truncateCheckBox->setHidden(true);
spinBox->setHidden(true);

connect( fButton,
         SIGNAL( clicked() ),
         this,
         SLOT( select_file() ) );
}

SaveXMLDialog::~SaveXMLDialog()
{
}

QMap<QString, QVariant> SaveXMLDialog::return_data()
{
QMap<QString, QVariant> m;
m["file"] = QVariant(f);
    if ( true == descCheckBox->isChecked() )
    {
    m["desc"] = QVariant( QString( QLatin1String("Y") ) );
        if ( true == truncateCheckBox->isChecked() )
        {
        m["trunc"] = QVariant( QString( QLatin1String("Y") ) );
        m["chars"] = QVariant( spinBox->value() );
        }
    }
return m;
}

void SaveXMLDialog::select_file()
{
f = QFileDialog::getSaveFileName( this,
                                  tr("Select File"),
                                  s,
                                  tr("MS Spreadsheet XML Files (*.xml);;") );
fLineEdit->setText( QDir::toNativeSeparators(f) );                                  
}

void SaveXMLDialog::set_file_name(QString s_)
{
s.clear();
s = QDir::homePath();
s.append( QDir::separator() );
s.append(s_);
}
